﻿<Application x:Class="PortUtil.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:viewModels="clr-namespace:PortUtil.ViewModels"
             StartupUri="Views\MainWindow.xaml">
    <Application.Resources>

        <ResourceDictionary>
            <viewModels:ViewModelLocator x:Key="Locator" />

            <Style TargetType="Control" x:Key="ErrorTemplate">
                <!--<Setter Property="Validation.ErrorTemplate">
                    <Setter.Value>
                        <ControlTemplate>
                            <TextBlock Foreground="Red" Text="DOH! Thank you for trying."/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>-->
                <Style.Triggers>
                    <Trigger Property="Validation.HasError" Value="true">
                        <Setter Property="ToolTip"
                                Value="{Binding Path=(Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource Self}}" />
                    </Trigger>
                </Style.Triggers>
            </Style>

            <Style TargetType="TextBox" BasedOn="{StaticResource ErrorTemplate}" />
            <Style TargetType="CheckBox" BasedOn="{StaticResource ErrorTemplate}" />
            <Style TargetType="ComboBox" BasedOn="{StaticResource ErrorTemplate}" />

        </ResourceDictionary>

    </Application.Resources>
</Application>